package com.crealth.model;

import java.io.Serializable;

import com.alibaba.fastjson.JSONObject;

public class ConsumerSelfModel implements Serializable {
	private static final long serialVersionUID = 9210486L;
	
	private int id;
	private int consumerID;
	private String companyName;
	private int companyAddr;
	private int setupTime;
	private int shareRate;
	private int publicBill;
	private int privateBill;
	private int monthTurnover;
	private int duty;
	private int monthRent;
	private int staffNum;
	private int socialSecurityNum;
	private int caseNum;
	private int childSZSchool;
	private int marriage;
	private int industry;
	
	public ConsumerSelfModel() {
		companyName = "";
		companyAddr = -1;
		setupTime = -1;
		shareRate = -1;
		publicBill = -1;
		privateBill = -1;
		monthTurnover = -1;
		duty = -1;
		monthRent = -1;
		staffNum = -1;
		socialSecurityNum = -1;
		caseNum = -1;
		childSZSchool = -1;
		marriage = -1;
		industry = -1;
	}
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getConsumerID() {
		return consumerID;
	}
	public void setConsumerID(int consumerID) {
		this.consumerID = consumerID;
	}
	public String getCompanyName() {
		return companyName;
	}
	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}
	public int getCompanyAddr() {
		return companyAddr;
	}
	public void setCompanyAddr(int companyAddr) {
		this.companyAddr = companyAddr;
	}
	public int getSetupTime() {
		return setupTime;
	}
	public void setSetupTime(int setupTime) {
		this.setupTime = setupTime;
	}
	public int getShareRate() {
		return shareRate;
	}
	public void setShareRate(int shareRate) {
		this.shareRate = shareRate;
	}
	public int getPublicBill() {
		return publicBill;
	}
	public void setPublicBill(int publicBill) {
		this.publicBill = publicBill;
	}
	public int getPrivateBill() {
		return privateBill;
	}
	public void setPrivateBill(int privateBill) {
		this.privateBill = privateBill;
	}
	public int getMonthTurnover() {
		return monthTurnover;
	}
	public void setMonthTurnover(int monthTurnover) {
		this.monthTurnover = monthTurnover;
	}
	public int getDuty() {
		return duty;
	}
	public void setDuty(int duty) {
		this.duty = duty;
	}
	public int getMonthRent() {
		return monthRent;
	}
	public void setMonthRent(int monthRent) {
		this.monthRent = monthRent;
	}
	public int getStaffNum() {
		return staffNum;
	}
	public void setStaffNum(int staffNum) {
		this.staffNum = staffNum;
	}
	public int getSocialSecurityNum() {
		return socialSecurityNum;
	}
	public void setSocialSecurityNum(int socialSecurityNum) {
		this.socialSecurityNum = socialSecurityNum;
	}
	public int getCaseNum() {
		return caseNum;
	}
	public void setCaseNum(int caseNum) {
		this.caseNum = caseNum;
	}
	public int getChildSZSchool() {
		return childSZSchool;
	}
	public void setChildSZSchool(int childSZSchool) {
		this.childSZSchool = childSZSchool;
	}
	public int getMarriage() {
		return marriage;
	}
	public void setMarriage(int marriage) {
		this.marriage = marriage;
	}
	public int getIndustry() {
		return industry;
	}
	public void setIndustry(int industry) {
		this.industry = industry;
	}	
	
	public void parseFromJson(JSONObject jsonData) {
		if (jsonData.containsKey("comName")) {
			this.companyName = jsonData.getString("comName");
		}
		if (jsonData.containsKey("comAddr")) {
			this.companyAddr = jsonData.getIntValue("comAddr");
		}
		if (jsonData.containsKey("setupTime")) {
			this.setupTime = jsonData.getIntValue("setupTime");
		}
		if (jsonData.containsKey("shareRate")) {
			this.shareRate = jsonData.getIntValue("shareRate");
		}
		if (jsonData.containsKey("publicTurnOver")) {
			this.publicBill = jsonData.getIntValue("publicTurnOver");
		}
		if (jsonData.containsKey("privateTurnOver")) {
			this.privateBill = jsonData.getIntValue("privateTurnOver");
		}
		if (jsonData.containsKey("monthTurnOver")) {
			this.monthTurnover = jsonData.getIntValue("monthTurnOver");
		}
		if (jsonData.containsKey("position")) {
			this.duty = jsonData.getIntValue("position");
		}
		if (jsonData.containsKey("monthRent")) {
			this.monthRent = jsonData.getIntValue("monthRent");
		}
		if (jsonData.containsKey("staffNum")) {
			this.staffNum = jsonData.getIntValue("staffNum");
		}
		if (jsonData.containsKey("shebaoNum")) {
			this.socialSecurityNum = jsonData.getIntValue("shebaoNum");
		}
		if (jsonData.containsKey("caseNum")) {
			this.caseNum = jsonData.getIntValue("caseNum");
		}
		if (jsonData.containsKey("childSZSchool")) {
			this.childSZSchool = jsonData.getIntValue("childSZSchool");
		}
		if (jsonData.containsKey("marriageStatus")) {
			this.marriage = jsonData.getIntValue("marriageStatus");
		}
		if (jsonData.containsKey("industry")) {
			this.industry = jsonData.getIntValue("industry");
		}		
	}
	
	public JSONObject toJSONObject() {
		JSONObject jsonObj = new JSONObject();
		if (companyName.length() > 0) {
			jsonObj.put("comName", companyName);
		}
		if (companyAddr >= 0) {
			jsonObj.put("comAddr", companyAddr);
		}
		if (setupTime >= 0) {
			jsonObj.put("setupTime", setupTime);
		}
		if (shareRate >= 0) {
			jsonObj.put("shareRate", shareRate);
		}
		if (publicBill >= 0) {
			jsonObj.put("publicTurnOver", publicBill);
		}
		if (privateBill >= 0) {
			jsonObj.put("privateTurnOver", privateBill);
		}
		if (monthTurnover >= 0) {
			jsonObj.put("monthTurnOver", monthTurnover);
		}
		if (duty >= 0) {
			jsonObj.put("position", duty);
		}
		if (monthRent >= 0) {
			jsonObj.put("monthRent", monthRent);
		}
		if (staffNum >= 0) {
			jsonObj.put("staffNum", staffNum);
		}
		if (socialSecurityNum >= 0) {
			jsonObj.put("shebaoNum", socialSecurityNum);
		}
		if (caseNum >= 0) {
			jsonObj.put("caseNum", caseNum);
		}
		if (childSZSchool >= 0) {
			jsonObj.put("childSZSchool", childSZSchool);
		}
		if (marriage >= 0) {
			jsonObj.put("marriageStatus", marriage);
		}
		if (industry >= 0) {
			jsonObj.put("industry", industry);
		}
		
		return jsonObj;
	}

}
